<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /*设置背景颜色，宽度，高度，清楚默认样式  */
      input[id="first"] {
        background-color: red;
        height: 80px;
        width: 80px;
        appearance: none;
      }
      input[id="second"] {
        background-color: lightgreen;
        height: 80px;
        width: 80px;
        appearance: none;
      }
      input[id="third"] {
        background-color: yellow;
        height: 80px;
        width: 80px;
        appearance: none;
      }
      div {
        height: 400px;
        width: 400px;
        border: solid;
      }
      /* 选中单选框时input的兄弟元素div背景色变为红色 */
      input[id="first"]:checked ~ div {
        background-color: red;
      }
      /* 选中单选框时input的兄弟元素div背景色变为绿色 */
      input[id="second"]:checked ~ div {
        background-color: lightgreen;
      }
      /* 选中单选框时input的兄弟元素div背景色变为黄色 */
      input[id="third"]:checked ~ div {
        background-color: yellow;
      }
      /* 选中input时变成圆形 */
      input:checked {
        border-radius: 50%;
        border: solid;
      }
    </style>
  </head>
  <body>
    <input type="radio" id="first" name="color" />
    <input type="radio" id="second" name="color" />
    <input type="radio" id="third" name="color" />
    <div></div>
  </body>
</html>
